<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="../../styles/base/base.css" type="text/css" media="screen" />
</head>
<body style="background-color:#eeeeee;">
<pre style="color:#000000; background-color:#eeeeee; font-size:8pt; font-family:'Courier New';"><span style="color:#303030">   1 </span><span style="color:#bb7977; font-weight:bold">package</span> no<span style="color:#ff0080; font-weight:bold">.</span>knowit<span style="color:#ff0080; font-weight:bold">.</span>seam<span style="color:#ff0080; font-weight:bold">.</span>example<span style="color:#ff0080; font-weight:bold">.</span>action<span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030">   2 </span>
<span style="color:#303030">   3 </span><span style="color:#bb7977; font-weight:bold">import</span> java<span style="color:#ff0080; font-weight:bold">.</span>util<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#0080c0">ArrayList</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030">   4 </span><span style="color:#bb7977; font-weight:bold">import</span> java<span style="color:#ff0080; font-weight:bold">.</span>util<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#0080c0">List</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030">   5 </span>
<span style="color:#303030">   6 </span><span style="color:#bb7977; font-weight:bold">import</span> javax<span style="color:#ff0080; font-weight:bold">.</span>naming<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#0080c0">NamingException</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030">   7 </span>
<span style="color:#303030">   8 </span><span style="color:#bb7977; font-weight:bold">import</span> no<span style="color:#ff0080; font-weight:bold">.</span>knowit<span style="color:#ff0080; font-weight:bold">.</span>crud<span style="color:#ff0080; font-weight:bold">.</span>CrudService<span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030">   9 </span><span style="color:#bb7977; font-weight:bold">import</span> no<span style="color:#ff0080; font-weight:bold">.</span>knowit<span style="color:#ff0080; font-weight:bold">.</span>seam<span style="color:#ff0080; font-weight:bold">.</span>example<span style="color:#ff0080; font-weight:bold">.</span>model<span style="color:#ff0080; font-weight:bold">.</span>Movie<span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030">  10 </span><span style="color:#bb7977; font-weight:bold">import</span> no<span style="color:#ff0080; font-weight:bold">.</span>knowit<span style="color:#ff0080; font-weight:bold">.</span>seam<span style="color:#ff0080; font-weight:bold">.</span>openejb<span style="color:#ff0080; font-weight:bold">.</span>mock<span style="color:#ff0080; font-weight:bold">.</span>SeamOpenEjbTest<span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030">  11 </span>
<span style="color:#303030">  12 </span><span style="color:#bb7977; font-weight:bold">import</span> org<span style="color:#ff0080; font-weight:bold">.</span>jboss<span style="color:#ff0080; font-weight:bold">.</span>seam<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#0080c0">Component</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030">  13 </span><span style="color:#bb7977; font-weight:bold">import</span> org<span style="color:#ff0080; font-weight:bold">.</span>jboss<span style="color:#ff0080; font-weight:bold">.</span>seam<span style="color:#ff0080; font-weight:bold">.</span>core<span style="color:#ff0080; font-weight:bold">.</span>Conversation<span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030">  14 </span><span style="color:#bb7977; font-weight:bold">import</span> org<span style="color:#ff0080; font-weight:bold">.</span>jboss<span style="color:#ff0080; font-weight:bold">.</span>seam<span style="color:#ff0080; font-weight:bold">.</span>log<span style="color:#ff0080; font-weight:bold">.</span>LogProvider<span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030">  15 </span><span style="color:#bb7977; font-weight:bold">import</span> org<span style="color:#ff0080; font-weight:bold">.</span>jboss<span style="color:#ff0080; font-weight:bold">.</span>seam<span style="color:#ff0080; font-weight:bold">.</span>log<span style="color:#ff0080; font-weight:bold">.</span>Logging<span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030">  16 </span><span style="color:#bb7977; font-weight:bold">import</span> org<span style="color:#ff0080; font-weight:bold">.</span>jboss<span style="color:#ff0080; font-weight:bold">.</span>seam<span style="color:#ff0080; font-weight:bold">.</span>security<span style="color:#ff0080; font-weight:bold">.</span>Credentials<span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030">  17 </span><span style="color:#bb7977; font-weight:bold">import</span> org<span style="color:#ff0080; font-weight:bold">.</span>jboss<span style="color:#ff0080; font-weight:bold">.</span>seam<span style="color:#ff0080; font-weight:bold">.</span>security<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#0080c0">Identity</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030">  18 </span><span style="color:#bb7977; font-weight:bold">import</span> org<span style="color:#ff0080; font-weight:bold">.</span>testng<span style="color:#ff0080; font-weight:bold">.</span>Assert<span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030">  19 </span><span style="color:#bb7977; font-weight:bold">import</span> org<span style="color:#ff0080; font-weight:bold">.</span>testng<span style="color:#ff0080; font-weight:bold">.</span>annotations<span style="color:#ff0080; font-weight:bold">.</span>BeforeClass<span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030">  20 </span><span style="color:#bb7977; font-weight:bold">import</span> org<span style="color:#ff0080; font-weight:bold">.</span>testng<span style="color:#ff0080; font-weight:bold">.</span>annotations<span style="color:#ff0080; font-weight:bold">.</span>BeforeSuite<span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030">  21 </span><span style="color:#bb7977; font-weight:bold">import</span> org<span style="color:#ff0080; font-weight:bold">.</span>testng<span style="color:#ff0080; font-weight:bold">.</span>annotations<span style="color:#ff0080; font-weight:bold">.</span>Test<span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030">  22 </span>
<span style="color:#303030">  23 </span><span style="color:#bb7977; font-weight:bold">public class</span> MovieTest <span style="color:#bb7977; font-weight:bold">extends</span> <strong style="color:green">SeamOpenEjbTest</strong> <span style="color:#ff0080; font-weight:bold">{</span>
<span style="color:#303030">  24 </span>
<span style="color:#303030">  25 </span>  <span style="color:#bb7977; font-weight:bold">private static final</span> <span style="color:#0080c0">String</span>  DIRECTOR_JOEL_COEN<span style="color:#ff0080; font-weight:bold">=</span> <span style="color:#a68500">&quot;Joel Coen&quot;</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030">  26 </span>  <span style="color:#bb7977; font-weight:bold">private static final</span> <span style="color:#0080c0">String</span>  THE_WALL_DIRECTOR <span style="color:#ff0080; font-weight:bold">=</span> <span style="color:#a68500">&quot;Alan Parker&quot;</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030">  27 </span>  <span style="color:#bb7977; font-weight:bold">private static final</span> <span style="color:#0080c0">String</span>  THE_WALL_TITLE    <span style="color:#ff0080; font-weight:bold">=</span> <span style="color:#a68500">&quot;The Wall&quot;</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030">  28 </span>  <span style="color:#bb7977; font-weight:bold">private static final</span> <span style="color:#0080c0">Integer</span> THE_WALL_YEAR     <span style="color:#ff0080; font-weight:bold">=</span> <span style="color:#800080; font-weight:bold">1992</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030">  29 </span>  <span style="color:#bb7977; font-weight:bold">private static final</span> <span style="color:#0080c0">String</span>  THE_WALL_PLOT     <span style="color:#ff0080; font-weight:bold">=</span> <span style="color:#a68500">&quot;A troubled rock star descends into madness in the &quot;</span> <span style="color:#ff0080; font-weight:bold">+</span>
<span style="color:#303030">  30 </span>                                                   <span style="color:#a68500">&quot;midst of his physical and social isolation from everyone.&quot;</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030">  31 </span>  <span style="color:#bb7977; font-weight:bold">private</span> <span style="color:#0080c0">Integer</span>              theWallId<span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030">  32 </span>
<span style="color:#303030">  33 </span>  <span style="color:#bb7977; font-weight:bold">private static final</span> LogProvider log <span style="color:#ff0080; font-weight:bold">=</span> Logging<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">getLogProvider</span><span style="color:#ff0080; font-weight:bold">(</span>MovieTest<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#bb7977; font-weight:bold">class</span><span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030">  34 </span>
<span style="color:#303030">  35 </span>  <span style="color:#bb7977; font-weight:bold">private</span> CrudService <span style="color:#004466">lookupCrudService</span><span style="color:#ff0080; font-weight:bold">()</span> <span style="color:#bb7977; font-weight:bold">throws</span> <span style="color:#0080c0">Exception</span> <span style="color:#ff0080; font-weight:bold">{</span>
<span style="color:#303030">  36 </span>    <span style="color:#bb7977; font-weight:bold">try</span> <span style="color:#ff0080; font-weight:bold">{</span>
<span style="color:#303030">  37 </span>      <span style="color:#0080c0">Object</span> service <span style="color:#ff0080; font-weight:bold">=</span> initialContext<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">lookup</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;crudService/Local&quot;</span><span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030">  38 </span>      assert service <span style="color:#ff0080; font-weight:bold">!=</span> null <span style="color:#ff0080; font-weight:bold">:</span> <span style="color:#a68500">&quot;initialContext.lookup(</span><span style="color:#ff00ff; font-weight:bold">\&quot;</span><span style="color:#a68500">crudService/Local</span><span style="color:#ff00ff; font-weight:bold">\&quot;</span><span style="color:#a68500">) returned null&quot;</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030">  39 </span>      assert service <span style="color:#bb7977; font-weight:bold">instanceof</span> CrudService <span style="color:#ff0080; font-weight:bold">:</span> <span style="color:#a68500">&quot;initialContext.lookup(</span><span style="color:#ff00ff; font-weight:bold">\&quot;</span><span style="color:#a68500">crudService/Local</span><span style="color:#ff00ff; font-weight:bold">\&quot;</span><span style="color:#a68500">) returned incorrect type&quot;</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030">  40 </span>      <span style="color:#bb7977; font-weight:bold">return</span> <span style="color:#ff0080; font-weight:bold">(</span>CrudService<span style="color:#ff0080; font-weight:bold">)</span> service<span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030">  41 </span>    <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030">  42 </span>    <span style="color:#bb7977; font-weight:bold">catch</span> <span style="color:#ff0080; font-weight:bold">(</span><span style="color:#0080c0">NamingException</span> e<span style="color:#ff0080; font-weight:bold">) {</span>
<span style="color:#303030">  43 </span>      log<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">error</span><span style="color:#ff0080; font-weight:bold">(</span>e<span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030">  44 </span>      <span style="color:#bb7977; font-weight:bold">throw</span><span style="color:#ff0080; font-weight:bold">(</span>e<span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030">  45 </span>    <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030">  46 </span>  <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030">  47 </span>
<span style="color:#303030">  48 </span>  <span style="color:#bb7977; font-weight:bold">private</span> <span style="color:#8080c0; font-weight:bold">boolean</span> <span style="color:#004466">mockLogin</span><span style="color:#ff0080; font-weight:bold">() {</span>
<span style="color:#303030">  49 </span>    Credentials credentials <span style="color:#ff0080; font-weight:bold">= (</span>Credentials<span style="color:#ff0080; font-weight:bold">)</span><span style="color:#0080c0">Component</span><span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">getInstance</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;org.jboss.seam.security.credentials&quot;</span><span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030">  50 </span>    <span style="color:#0080c0">Identity</span> identity <span style="color:#ff0080; font-weight:bold">= (</span><span style="color:#0080c0">Identity</span><span style="color:#ff0080; font-weight:bold">)</span><span style="color:#0080c0">Component</span><span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">getInstance</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;org.jboss.seam.security.identity&quot;</span><span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030">  51 </span>    credentials<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">setUsername</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;admin&quot;</span><span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030">  52 </span>    identity<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">addRole</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;admin&quot;</span><span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030">  53 </span>    <span style="color:#bb7977; font-weight:bold">return</span> identity<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">login</span><span style="color:#ff0080; font-weight:bold">().</span><span style="color:#004466">equals</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;loggedIn&quot;</span><span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030">  54 </span>  <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030">  55 </span>
<span style="color:#303030">  56 </span>  &#64;Override
<span style="color:#303030">  57 </span>  &#64;BeforeSuite
<span style="color:#303030">  58 </span>  <span style="color:#bb7977; font-weight:bold">public</span> <span style="color:#8080c0; font-weight:bold">void</span> <span style="color:#004466">beforeSuite</span><span style="color:#ff0080; font-weight:bold">()</span> <span style="color:#bb7977; font-weight:bold">throws</span> <span style="color:#0080c0">Exception</span> <span style="color:#ff0080; font-weight:bold">{</span>
<span style="color:#303030">  59 </span>
<span style="color:#303030">  60 </span>    <span style="color:#f27900">//System.out.println(&quot;**** MovieTest.beforeSuite()&quot;);</span>
<span style="color:#303030">  61 </span>
<span style="color:#303030">  62 </span>
<span style="color:#303030">  63 </span>    <span style="color:#f27900">// Change some logging, INFO|DEBUG|WARN|ERROR|FATAL</span>
<span style="color:#303030">  64 </span>    contextProperties<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">put</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;log4j.category.org.jboss.seam.Component&quot;</span><span style="color:#ff0080; font-weight:bold">,</span> <span style="color:#a68500">&quot;DEBUG&quot;</span><span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030">  65 </span>    contextProperties<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">put</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;log4j.category.org.jboss.seam.transaction&quot;</span><span style="color:#ff0080; font-weight:bold">,</span> <span style="color:#a68500">&quot;DEBUG&quot;</span><span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030">  66 </span>    contextProperties<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">put</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;log4j.category.org.jboss.seam.mock&quot;</span><span style="color:#ff0080; font-weight:bold">,</span> <span style="color:#a68500">&quot;DEBUG&quot;</span><span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030">  67 </span>
<span style="color:#303030">  68 </span>    contextProperties<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">put</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;log4j.category.no.knowit.seam.openejb.mock&quot;</span><span style="color:#ff0080; font-weight:bold">,</span> <span style="color:#a68500">&quot;DEBUG&quot;</span><span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030">  69 </span>
<span style="color:#303030">  70 </span>    contextProperties<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">put</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;log4j.category.no.knowit.seam.example&quot;</span><span style="color:#ff0080; font-weight:bold">,</span> <span style="color:#a68500">&quot;debug&quot;</span><span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030">  71 </span>
<span style="color:#303030">  72 </span>    <span style="color:#bb7977; font-weight:bold">super</span><span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">beforeSuite</span><span style="color:#ff0080; font-weight:bold">();</span>
<span style="color:#303030">  73 </span>  <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030">  74 </span>
<span style="color:#303030">  75 </span>  &#64;Override
<span style="color:#303030">  76 </span>  &#64;BeforeClass
<span style="color:#303030">  77 </span>  <span style="color:#bb7977; font-weight:bold">public</span> <span style="color:#8080c0; font-weight:bold">void</span> <span style="color:#004466">setupClass</span><span style="color:#ff0080; font-weight:bold">()</span> <span style="color:#bb7977; font-weight:bold">throws</span> <span style="color:#0080c0">Exception</span> <span style="color:#ff0080; font-weight:bold">{</span>
<span style="color:#303030">  78 </span>    <span style="color:#bb7977; font-weight:bold">super</span><span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">setupClass</span><span style="color:#ff0080; font-weight:bold">();</span>
<span style="color:#303030">  79 </span>
<span style="color:#303030">  80 </span>    <span style="color:#f27900">// Delete all movies</span>
<span style="color:#303030">  81 </span>    CrudService crudService <span style="color:#ff0080; font-weight:bold">=</span> <span style="color:#004466">lookupCrudService</span><span style="color:#ff0080; font-weight:bold">();</span>
<span style="color:#303030">  82 </span>    crudService<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">remove</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#bb7977; font-weight:bold">new</span> <span style="color:#004466">Movie</span><span style="color:#ff0080; font-weight:bold">(),</span> true<span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030">  83 </span>    assert crudService<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">find</span><span style="color:#ff0080; font-weight:bold">(</span>Movie<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#bb7977; font-weight:bold">class</span><span style="color:#ff0080; font-weight:bold">).</span><span style="color:#004466">size</span><span style="color:#ff0080; font-weight:bold">() ==</span> <span style="color:#800080; font-weight:bold">0</span> <span style="color:#ff0080; font-weight:bold">:</span> <span style="color:#a68500">&quot;List.size():&quot;</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030">  84 </span>
<span style="color:#303030">  85 </span>    <span style="color:#f27900">// Persist 3 movies</span>
<span style="color:#303030">  86 </span>    <span style="color:#0080c0">ArrayList</span><span style="color:#ff0080; font-weight:bold">&lt;</span>Movie<span style="color:#ff0080; font-weight:bold">&gt;</span> movies <span style="color:#ff0080; font-weight:bold">=</span> <span style="color:#bb7977; font-weight:bold">new</span> <span style="color:#0080c0">ArrayList</span><span style="color:#ff0080; font-weight:bold">&lt;</span>Movie<span style="color:#ff0080; font-weight:bold">&gt;();</span>
<span style="color:#303030">  87 </span>    movies<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">add</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#bb7977; font-weight:bold">new</span> <span style="color:#004466">Movie</span><span style="color:#ff0080; font-weight:bold">(</span>DIRECTOR_JOEL_COEN<span style="color:#ff0080; font-weight:bold">,</span> <span style="color:#a68500">&quot;The Big Lebowski&quot;</span><span style="color:#ff0080; font-weight:bold">,</span> <span style="color:#800080; font-weight:bold">1998</span><span style="color:#ff0080; font-weight:bold">,</span>
<span style="color:#303030">  88 </span>      <span style="color:#a68500">&quot;</span><span style="color:#ff00ff; font-weight:bold">\&quot;</span><span style="color:#a68500">Dude</span><span style="color:#ff00ff; font-weight:bold">\&quot;</span> <span style="color:#a68500">Lebowski, mistaken for a millionaire Lebowski, seeks restitution for his &quot;</span> <span style="color:#ff0080; font-weight:bold">+</span>
<span style="color:#303030">  89 </span>      <span style="color:#a68500">&quot;ruined rug and enlists his bowling buddies to help get it.&quot;</span><span style="color:#ff0080; font-weight:bold">));</span>
<span style="color:#303030">  90 </span>    movies<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">add</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#bb7977; font-weight:bold">new</span> <span style="color:#004466">Movie</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;Quentin Tarantino&quot;</span><span style="color:#ff0080; font-weight:bold">,</span> <span style="color:#a68500">&quot;Reservoir Dogs&quot;</span><span style="color:#ff0080; font-weight:bold">,</span> <span style="color:#800080; font-weight:bold">1992</span><span style="color:#ff0080; font-weight:bold">,</span>
<span style="color:#303030">  91 </span>      <span style="color:#a68500">&quot;After a simple jewelery heist goes terribly wrong, the surviving criminals begin &quot;</span> <span style="color:#ff0080; font-weight:bold">+</span>
<span style="color:#303030">  92 </span>      <span style="color:#a68500">&quot;to suspect that one of them is a police informant.&quot;</span><span style="color:#ff0080; font-weight:bold">));</span>
<span style="color:#303030">  93 </span>    movies<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">add</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#bb7977; font-weight:bold">new</span> <span style="color:#004466">Movie</span><span style="color:#ff0080; font-weight:bold">(</span>DIRECTOR_JOEL_COEN<span style="color:#ff0080; font-weight:bold">,</span> <span style="color:#a68500">&quot;Fargo&quot;</span><span style="color:#ff0080; font-weight:bold">,</span> <span style="color:#800080; font-weight:bold">1996</span><span style="color:#ff0080; font-weight:bold">,</span>
<span style="color:#303030">  94 </span>      <span style="color:#a68500">&quot;Jerry Lundegaard's inept crime falls apart due to his and his henchmen's bungling &quot;</span> <span style="color:#ff0080; font-weight:bold">+</span>
<span style="color:#303030">  95 </span>      <span style="color:#a68500">&quot;and the persistent police work of pregnant Marge Gunderson.&quot;</span><span style="color:#ff0080; font-weight:bold">));</span>
<span style="color:#303030">  96 </span>
<span style="color:#303030">  97 </span>    crudService<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">persist</span><span style="color:#ff0080; font-weight:bold">(</span>movies<span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030">  98 </span>  <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030">  99 </span>
<span style="color:#303030"> 100 </span>
<span style="color:#303030"> 101 </span>  &#64;Test
<span style="color:#303030"> 102 </span>  <span style="color:#bb7977; font-weight:bold">public</span> <span style="color:#8080c0; font-weight:bold">void</span> <span style="color:#004466">newMovie</span><span style="color:#ff0080; font-weight:bold">()</span> <span style="color:#bb7977; font-weight:bold">throws</span> <span style="color:#0080c0">Exception</span> <span style="color:#ff0080; font-weight:bold">{</span>
<span style="color:#303030"> 103 </span>
<span style="color:#303030"> 104 </span>    <span style="color:#bb7977; font-weight:bold">new</span> <span style="color:#004466">NonFacesRequest</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;/view/example/MovieList.xhtml&quot;</span><span style="color:#ff0080; font-weight:bold">) {</span>
<span style="color:#303030"> 105 </span>      &#64;Override
<span style="color:#303030"> 106 </span>      <span style="color:#bb7977; font-weight:bold">protected</span> <span style="color:#8080c0; font-weight:bold">void</span> <span style="color:#004466">renderResponse</span><span style="color:#ff0080; font-weight:bold">()</span> <span style="color:#bb7977; font-weight:bold">throws</span> <span style="color:#0080c0">Exception</span> <span style="color:#ff0080; font-weight:bold">{</span>
<span style="color:#303030"> 107 </span>        <span style="color:#8080c0; font-weight:bold">int</span> actual <span style="color:#ff0080; font-weight:bold">= (</span><span style="color:#0080c0">Integer</span><span style="color:#ff0080; font-weight:bold">)</span><span style="color:#004466">getValue</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;#{movieList.resultList.size}&quot;</span><span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 108 </span>        Assert<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">assertEquals</span><span style="color:#ff0080; font-weight:bold">(</span>actual<span style="color:#ff0080; font-weight:bold">,</span> <span style="color:#800080; font-weight:bold">3</span><span style="color:#ff0080; font-weight:bold">,</span> <span style="color:#a68500">&quot;movieList.size:&quot;</span><span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 109 </span>      <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 110 </span>    <span style="color:#ff0080; font-weight:bold">}.</span><span style="color:#004466">run</span><span style="color:#ff0080; font-weight:bold">();</span>
<span style="color:#303030"> 111 </span>
<span style="color:#303030"> 112 </span>    <span style="color:#bb7977; font-weight:bold">new</span> <span style="color:#004466">FacesRequest</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;/login.xhtml&quot;</span><span style="color:#ff0080; font-weight:bold">) {</span>
<span style="color:#303030"> 113 </span>      &#64;Override
<span style="color:#303030"> 114 </span>      <span style="color:#bb7977; font-weight:bold">protected</span> <span style="color:#8080c0; font-weight:bold">void</span> <span style="color:#004466">updateModelValues</span><span style="color:#ff0080; font-weight:bold">()</span> <span style="color:#bb7977; font-weight:bold">throws</span> <span style="color:#0080c0">Exception</span> <span style="color:#ff0080; font-weight:bold">{</span>
<span style="color:#303030"> 115 </span>        assert <span style="color:#ff0080; font-weight:bold">!</span><span style="color:#004466">isSessionInvalid</span><span style="color:#ff0080; font-weight:bold">() :</span> <span style="color:#a68500">&quot;Invalid session&quot;</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030"> 116 </span>        <span style="color:#004466">setValue</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;#{credentials.username}&quot;</span><span style="color:#ff0080; font-weight:bold">,</span> <span style="color:#a68500">&quot;admin&quot;</span><span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 117 </span>      <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 118 </span>
<span style="color:#303030"> 119 </span>      &#64;Override
<span style="color:#303030"> 120 </span>      <span style="color:#bb7977; font-weight:bold">protected</span> <span style="color:#8080c0; font-weight:bold">void</span> <span style="color:#004466">invokeApplication</span><span style="color:#ff0080; font-weight:bold">()</span> <span style="color:#bb7977; font-weight:bold">throws</span> <span style="color:#0080c0">Exception</span> <span style="color:#ff0080; font-weight:bold">{</span>
<span style="color:#303030"> 121 </span>        assert <span style="color:#004466">invokeMethod</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;#{authenticator.authenticate}&quot;</span><span style="color:#ff0080; font-weight:bold">).</span><span style="color:#004466">equals</span><span style="color:#ff0080; font-weight:bold">(</span>true<span style="color:#ff0080; font-weight:bold">) :</span> <span style="color:#a68500">&quot;Authentication failed&quot;</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030"> 122 </span>        assert <span style="color:#004466">invokeMethod</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;#{identity.login}&quot;</span><span style="color:#ff0080; font-weight:bold">).</span><span style="color:#004466">equals</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;loggedIn&quot;</span><span style="color:#ff0080; font-weight:bold">) :</span> <span style="color:#a68500">&quot;Login failed&quot;</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030"> 123 </span>        <span style="color:#004466">setOutcome</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;/view/example/MovieEdit.xhtml&quot;</span><span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 124 </span>      <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 125 </span>    <span style="color:#ff0080; font-weight:bold">}.</span><span style="color:#004466">run</span><span style="color:#ff0080; font-weight:bold">();</span>
<span style="color:#303030"> 126 </span>
<span style="color:#303030"> 127 </span>    <span style="color:#bb7977; font-weight:bold">new</span> <span style="color:#004466">FacesRequest</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;/view/example/MovieEdit.xhtml&quot;</span><span style="color:#ff0080; font-weight:bold">) {</span>
<span style="color:#303030"> 128 </span>      &#64;Override
<span style="color:#303030"> 129 </span>      <span style="color:#bb7977; font-weight:bold">protected</span> <span style="color:#8080c0; font-weight:bold">void</span> <span style="color:#004466">updateModelValues</span><span style="color:#ff0080; font-weight:bold">()</span> <span style="color:#bb7977; font-weight:bold">throws</span> <span style="color:#0080c0">Exception</span> <span style="color:#ff0080; font-weight:bold">{</span>
<span style="color:#303030"> 130 </span>        <span style="color:#004466">invokeMethod</span><span style="color:#ff0080; font-weight:bold">(</span> <span style="color:#a68500">&quot;#{movieHome.clearInstance}&quot;</span> <span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 131 </span>        <span style="color:#004466">setValue</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;#{movieHome.instance.director}&quot;</span><span style="color:#ff0080; font-weight:bold">,</span> THE_WALL_DIRECTOR<span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 132 </span>        <span style="color:#004466">setValue</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;#{movieHome.instance.title}&quot;</span><span style="color:#ff0080; font-weight:bold">,</span>    THE_WALL_TITLE<span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 133 </span>        <span style="color:#004466">setValue</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;#{movieHome.instance.year}&quot;</span><span style="color:#ff0080; font-weight:bold">,</span>     THE_WALL_YEAR<span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 134 </span>      <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 135 </span>
<span style="color:#303030"> 136 </span>      &#64;Override
<span style="color:#303030"> 137 </span>      <span style="color:#bb7977; font-weight:bold">protected</span> <span style="color:#8080c0; font-weight:bold">void</span> <span style="color:#004466">invokeApplication</span><span style="color:#ff0080; font-weight:bold">() {</span>
<span style="color:#303030"> 138 </span>        assert <span style="color:#004466">invokeMethod</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;#{movieHome.persist}&quot;</span><span style="color:#ff0080; font-weight:bold">).</span><span style="color:#004466">equals</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;persisted&quot;</span><span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 139 </span>        theWallId <span style="color:#ff0080; font-weight:bold">= (</span><span style="color:#0080c0">Integer</span><span style="color:#ff0080; font-weight:bold">)</span><span style="color:#004466">getValue</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;#{movieHome.movieId}&quot;</span><span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 140 </span>        <span style="color:#004466">setOutcome</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;/view/example/Movie.xhtml&quot;</span><span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 141 </span>      <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 142 </span>
<span style="color:#303030"> 143 </span>      &#64;Override
<span style="color:#303030"> 144 </span>      <span style="color:#bb7977; font-weight:bold">protected</span> <span style="color:#8080c0; font-weight:bold">void</span> <span style="color:#004466">afterRequest</span><span style="color:#ff0080; font-weight:bold">() {</span>
<span style="color:#303030"> 145 </span>        assert <span style="color:#004466">isInvokeApplicationComplete</span><span style="color:#ff0080; font-weight:bold">();</span>
<span style="color:#303030"> 146 </span>        assert <span style="color:#ff0080; font-weight:bold">!</span><span style="color:#004466">isRenderResponseBegun</span><span style="color:#ff0080; font-weight:bold">();</span>
<span style="color:#303030"> 147 </span>      <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 148 </span>    <span style="color:#ff0080; font-weight:bold">}.</span><span style="color:#004466">run</span><span style="color:#ff0080; font-weight:bold">();</span>
<span style="color:#303030"> 149 </span>
<span style="color:#303030"> 150 </span>    <span style="color:#bb7977; font-weight:bold">new</span> <span style="color:#004466">NonFacesRequest</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;/view/example/Movie.xhtml&quot;</span><span style="color:#ff0080; font-weight:bold">) {</span>
<span style="color:#303030"> 151 </span>      &#64;Override
<span style="color:#303030"> 152 </span>      <span style="color:#bb7977; font-weight:bold">protected</span> <span style="color:#8080c0; font-weight:bold">void</span> <span style="color:#004466">renderResponse</span><span style="color:#ff0080; font-weight:bold">() {</span>
<span style="color:#303030"> 153 </span>        <span style="color:#004466">setValue</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;#{movieHome.movieId}&quot;</span><span style="color:#ff0080; font-weight:bold">,</span> theWallId<span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 154 </span>        <span style="color:#004466">invokeMethod</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;#{movieHome.wire}&quot;</span><span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 155 </span>        assert <span style="color:#004466">getValue</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;#{movieHome.instance.director}&quot;</span><span style="color:#ff0080; font-weight:bold">).</span><span style="color:#004466">equals</span><span style="color:#ff0080; font-weight:bold">(</span>THE_WALL_DIRECTOR<span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 156 </span>        assert <span style="color:#004466">getValue</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;#{movieHome.instance.title}&quot;</span><span style="color:#ff0080; font-weight:bold">).</span><span style="color:#004466">equals</span><span style="color:#ff0080; font-weight:bold">(</span>THE_WALL_TITLE<span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 157 </span>        assert <span style="color:#004466">getValue</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;#{movieHome.instance.year}&quot;</span><span style="color:#ff0080; font-weight:bold">).</span><span style="color:#004466">equals</span><span style="color:#ff0080; font-weight:bold">(</span>THE_WALL_YEAR<span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 158 </span>      <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 159 </span>    <span style="color:#ff0080; font-weight:bold">}.</span><span style="color:#004466">run</span><span style="color:#ff0080; font-weight:bold">();</span>
<span style="color:#303030"> 160 </span>
<span style="color:#303030"> 161 </span>    <span style="color:#bb7977; font-weight:bold">new</span> <span style="color:#004466">FacesRequest</span><span style="color:#ff0080; font-weight:bold">() {</span>
<span style="color:#303030"> 162 </span>      &#64;Override
<span style="color:#303030"> 163 </span>      <span style="color:#bb7977; font-weight:bold">protected</span> <span style="color:#8080c0; font-weight:bold">void</span> <span style="color:#004466">invokeApplication</span><span style="color:#ff0080; font-weight:bold">()</span> <span style="color:#bb7977; font-weight:bold">throws</span> <span style="color:#0080c0">Exception</span> <span style="color:#ff0080; font-weight:bold">{</span>
<span style="color:#303030"> 164 </span>        assert <span style="color:#004466">getValue</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;#{identity.loggedIn}&quot;</span><span style="color:#ff0080; font-weight:bold">).</span><span style="color:#004466">equals</span><span style="color:#ff0080; font-weight:bold">(</span>true<span style="color:#ff0080; font-weight:bold">) :</span> <span style="color:#a68500">&quot;Not logged in&quot;</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030"> 165 </span>        assert <span style="color:#004466">invokeAction</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;#{identity.logout}&quot;</span><span style="color:#ff0080; font-weight:bold">) ==</span> null<span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030"> 166 </span>        assert <span style="color:#004466">getValue</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;#{identity.loggedIn}&quot;</span><span style="color:#ff0080; font-weight:bold">).</span><span style="color:#004466">equals</span><span style="color:#ff0080; font-weight:bold">(</span>false<span style="color:#ff0080; font-weight:bold">) :</span> <span style="color:#a68500">&quot;Logout failed&quot;</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030"> 167 </span>      <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 168 </span>    <span style="color:#ff0080; font-weight:bold">}.</span><span style="color:#004466">run</span><span style="color:#ff0080; font-weight:bold">();</span>
<span style="color:#303030"> 169 </span>  <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 170 </span>
<span style="color:#303030"> 171 </span>  &#64;<span style="color:#004466">Test</span><span style="color:#ff0080; font-weight:bold">(</span>dependsOnMethods<span style="color:#ff0080; font-weight:bold">={</span> <span style="color:#a68500">&quot;newMovie&quot;</span> <span style="color:#ff0080; font-weight:bold">})</span>
<span style="color:#303030"> 172 </span>  <span style="color:#bb7977; font-weight:bold">public</span> <span style="color:#8080c0; font-weight:bold">void</span> <span style="color:#004466">editMovie</span><span style="color:#ff0080; font-weight:bold">()</span> <span style="color:#bb7977; font-weight:bold">throws</span> <span style="color:#0080c0">Exception</span> <span style="color:#ff0080; font-weight:bold">{</span>
<span style="color:#303030"> 173 </span>    <span style="color:#bb7977; font-weight:bold">new</span> <span style="color:#004466">FacesRequest</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;/view/example/MovieEdit.xhtml&quot;</span><span style="color:#ff0080; font-weight:bold">) {</span>
<span style="color:#303030"> 174 </span>      &#64;Override
<span style="color:#303030"> 175 </span>      <span style="color:#bb7977; font-weight:bold">protected</span> <span style="color:#8080c0; font-weight:bold">void</span> <span style="color:#004466">invokeApplication</span><span style="color:#ff0080; font-weight:bold">()</span> <span style="color:#bb7977; font-weight:bold">throws</span> <span style="color:#0080c0">Exception</span> <span style="color:#ff0080; font-weight:bold">{</span>
<span style="color:#303030"> 176 </span>        Conversation<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">instance</span><span style="color:#ff0080; font-weight:bold">().</span><span style="color:#004466">begin</span><span style="color:#ff0080; font-weight:bold">();</span>
<span style="color:#303030"> 177 </span>        assert <span style="color:#ff0080; font-weight:bold">!</span><span style="color:#004466">isSessionInvalid</span><span style="color:#ff0080; font-weight:bold">() :</span> <span style="color:#a68500">&quot;Invalid session&quot;</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030"> 178 </span>        assert <span style="color:#004466">mockLogin</span><span style="color:#ff0080; font-weight:bold">() :</span> <span style="color:#a68500">&quot;Login failed&quot;</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030"> 179 </span>        <span style="color:#004466">setValue</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;#{movieHome.movieId}&quot;</span><span style="color:#ff0080; font-weight:bold">,</span> theWallId<span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 180 </span>        <span style="color:#004466">invokeMethod</span><span style="color:#ff0080; font-weight:bold">(</span> <span style="color:#a68500">&quot;#{movieHome.wire}&quot;</span> <span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 181 </span>        <span style="color:#004466">setValue</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;#{movieHome.instance.plot}&quot;</span><span style="color:#ff0080; font-weight:bold">,</span> THE_WALL_PLOT<span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 182 </span>        <span style="color:#0080c0">Object</span> result <span style="color:#ff0080; font-weight:bold">=</span> <span style="color:#004466">invokeMethod</span><span style="color:#ff0080; font-weight:bold">(</span> <span style="color:#a68500">&quot;#{movieHome.update}&quot;</span> <span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 183 </span>        Assert<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">assertEquals</span><span style="color:#ff0080; font-weight:bold">(</span>result<span style="color:#ff0080; font-weight:bold">,</span> <span style="color:#a68500">&quot;updated&quot;</span><span style="color:#ff0080; font-weight:bold">,</span> <span style="color:#a68500">&quot;#{movieHome.update}&quot;</span><span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 184 </span>        Conversation<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">instance</span><span style="color:#ff0080; font-weight:bold">().</span><span style="color:#004466">end</span><span style="color:#ff0080; font-weight:bold">();</span>
<span style="color:#303030"> 185 </span>      <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 186 </span>    <span style="color:#ff0080; font-weight:bold">}.</span><span style="color:#004466">run</span><span style="color:#ff0080; font-weight:bold">();</span>
<span style="color:#303030"> 187 </span>  <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 188 </span>
<span style="color:#303030"> 189 </span>  &#64;<span style="color:#004466">Test</span><span style="color:#ff0080; font-weight:bold">(</span>dependsOnMethods<span style="color:#ff0080; font-weight:bold">={</span> <span style="color:#a68500">&quot;editMovie&quot;</span> <span style="color:#ff0080; font-weight:bold">})</span>
<span style="color:#303030"> 190 </span>  <span style="color:#bb7977; font-weight:bold">public</span> <span style="color:#8080c0; font-weight:bold">void</span> <span style="color:#004466">unauthorizedAccess</span><span style="color:#ff0080; font-weight:bold">()</span> <span style="color:#bb7977; font-weight:bold">throws</span> <span style="color:#0080c0">Exception</span> <span style="color:#ff0080; font-weight:bold">{</span>
<span style="color:#303030"> 191 </span>    <span style="color:#bb7977; font-weight:bold">new</span> <span style="color:#004466">FacesRequest</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;/view/example/MovieEdit.xhtml&quot;</span><span style="color:#ff0080; font-weight:bold">) {</span>
<span style="color:#303030"> 192 </span>      &#64;Override
<span style="color:#303030"> 193 </span>      <span style="color:#bb7977; font-weight:bold">protected</span> <span style="color:#8080c0; font-weight:bold">void</span> <span style="color:#004466">invokeApplication</span><span style="color:#ff0080; font-weight:bold">()</span> <span style="color:#bb7977; font-weight:bold">throws</span> <span style="color:#0080c0">Exception</span> <span style="color:#ff0080; font-weight:bold">{</span>
<span style="color:#303030"> 194 </span>        Conversation<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">instance</span><span style="color:#ff0080; font-weight:bold">().</span><span style="color:#004466">begin</span><span style="color:#ff0080; font-weight:bold">();</span>
<span style="color:#303030"> 195 </span>        assert <span style="color:#ff0080; font-weight:bold">!</span><span style="color:#004466">isSessionInvalid</span><span style="color:#ff0080; font-weight:bold">() :</span> <span style="color:#a68500">&quot;Invalid session&quot;</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030"> 196 </span>        <span style="color:#004466">setValue</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;#{movieHome.movieId}&quot;</span><span style="color:#ff0080; font-weight:bold">,</span> theWallId<span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 197 </span>        <span style="color:#004466">invokeMethod</span><span style="color:#ff0080; font-weight:bold">(</span> <span style="color:#a68500">&quot;#{movieHome.wire}&quot;</span> <span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 198 </span>        <span style="color:#004466">setValue</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;#{movieHome.instance.plot}&quot;</span><span style="color:#ff0080; font-weight:bold">,</span> THE_WALL_PLOT<span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 199 </span>
<span style="color:#303030"> 200 </span>        <span style="color:#bb7977; font-weight:bold">try</span> <span style="color:#ff0080; font-weight:bold">{</span>
<span style="color:#303030"> 201 </span>          <span style="color:#004466">invokeMethod</span><span style="color:#ff0080; font-weight:bold">(</span> <span style="color:#a68500">&quot;#{movieHome.update}&quot;</span> <span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 202 </span>          assert false <span style="color:#ff0080; font-weight:bold">:</span> <span style="color:#a68500">&quot;Unauthorized access!&quot;</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030"> 203 </span>        <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 204 </span>        <span style="color:#bb7977; font-weight:bold">catch</span> <span style="color:#ff0080; font-weight:bold">(</span>javax<span style="color:#ff0080; font-weight:bold">.</span>el<span style="color:#ff0080; font-weight:bold">.</span>ELException e<span style="color:#ff0080; font-weight:bold">) {</span>
<span style="color:#303030"> 205 </span>          assert e<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">getCause</span><span style="color:#ff0080; font-weight:bold">()</span> <span style="color:#bb7977; font-weight:bold">instanceof</span> org<span style="color:#ff0080; font-weight:bold">.</span>jboss<span style="color:#ff0080; font-weight:bold">.</span>seam<span style="color:#ff0080; font-weight:bold">.</span>security<span style="color:#ff0080; font-weight:bold">.</span>NotLoggedInException <span style="color:#ff0080; font-weight:bold">:</span>
<span style="color:#303030"> 206 </span>            <span style="color:#a68500">&quot;Expected to fail with: 'org.jboss.seam.security.NotLoggedInException'&quot;</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030"> 207 </span>
<span style="color:#303030"> 208 </span>          log<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">debug</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;Passed expected unauthorized access failure: &quot;</span> <span style="color:#ff0080; font-weight:bold">+</span> e<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">getMessage</span><span style="color:#ff0080; font-weight:bold">());</span>
<span style="color:#303030"> 209 </span>        <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 210 </span>        <span style="color:#bb7977; font-weight:bold">finally</span> <span style="color:#ff0080; font-weight:bold">{</span>
<span style="color:#303030"> 211 </span>          Conversation<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">instance</span><span style="color:#ff0080; font-weight:bold">().</span><span style="color:#004466">end</span><span style="color:#ff0080; font-weight:bold">();</span>
<span style="color:#303030"> 212 </span>        <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 213 </span>      <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 214 </span>    <span style="color:#ff0080; font-weight:bold">}.</span><span style="color:#004466">run</span><span style="color:#ff0080; font-weight:bold">();</span>
<span style="color:#303030"> 215 </span>  <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 216 </span>
<span style="color:#303030"> 217 </span>  &#64;<span style="color:#004466">Test</span><span style="color:#ff0080; font-weight:bold">(</span>dependsOnMethods<span style="color:#ff0080; font-weight:bold">={</span> <span style="color:#a68500">&quot;editMovie&quot;</span> <span style="color:#ff0080; font-weight:bold">})</span>
<span style="color:#303030"> 218 </span>  <span style="color:#bb7977; font-weight:bold">public</span> <span style="color:#8080c0; font-weight:bold">void</span> <span style="color:#004466">persistWithMissingRequiredFieldValue</span><span style="color:#ff0080; font-weight:bold">()</span> <span style="color:#bb7977; font-weight:bold">throws</span> <span style="color:#0080c0">Exception</span> <span style="color:#ff0080; font-weight:bold">{</span>
<span style="color:#303030"> 219 </span>    <span style="color:#bb7977; font-weight:bold">new</span> <span style="color:#004466">FacesRequest</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;/view/example/MovieEdit.xhtml&quot;</span><span style="color:#ff0080; font-weight:bold">) {</span>
<span style="color:#303030"> 220 </span>      &#64;Override
<span style="color:#303030"> 221 </span>      <span style="color:#bb7977; font-weight:bold">protected</span> <span style="color:#8080c0; font-weight:bold">void</span> <span style="color:#004466">invokeApplication</span><span style="color:#ff0080; font-weight:bold">()</span> <span style="color:#bb7977; font-weight:bold">throws</span> <span style="color:#0080c0">Exception</span> <span style="color:#ff0080; font-weight:bold">{</span>
<span style="color:#303030"> 222 </span>        Conversation<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">instance</span><span style="color:#ff0080; font-weight:bold">().</span><span style="color:#004466">begin</span><span style="color:#ff0080; font-weight:bold">();</span>
<span style="color:#303030"> 223 </span>        assert <span style="color:#ff0080; font-weight:bold">!</span><span style="color:#004466">isSessionInvalid</span><span style="color:#ff0080; font-weight:bold">() :</span> <span style="color:#a68500">&quot;Invalid session&quot;</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030"> 224 </span>        assert <span style="color:#004466">mockLogin</span><span style="color:#ff0080; font-weight:bold">() :</span> <span style="color:#a68500">&quot;Login failed&quot;</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030"> 225 </span>        <span style="color:#004466">invokeMethod</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;#{movieHome.clearInstance}&quot;</span><span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 226 </span>        <span style="color:#004466">setValue</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;#{movieHome.instance.director}&quot;</span><span style="color:#ff0080; font-weight:bold">,</span> THE_WALL_DIRECTOR<span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 227 </span>        <span style="color:#004466">setValue</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;#{movieHome.instance.year}&quot;</span><span style="color:#ff0080; font-weight:bold">,</span>     THE_WALL_YEAR<span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 228 </span>
<span style="color:#303030"> 229 </span>        <span style="color:#bb7977; font-weight:bold">try</span> <span style="color:#ff0080; font-weight:bold">{</span>
<span style="color:#303030"> 230 </span>          <span style="color:#004466">invokeMethod</span><span style="color:#ff0080; font-weight:bold">(</span> <span style="color:#a68500">&quot;#{movieHome.persist}&quot;</span> <span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 231 </span>          assert false <span style="color:#ff0080; font-weight:bold">:</span> <span style="color:#a68500">&quot;Movie with missing field value persisted!&quot;</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030"> 232 </span>        <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 233 </span>        <span style="color:#bb7977; font-weight:bold">catch</span> <span style="color:#ff0080; font-weight:bold">(</span>javax<span style="color:#ff0080; font-weight:bold">.</span>el<span style="color:#ff0080; font-weight:bold">.</span>ELException e<span style="color:#ff0080; font-weight:bold">) {</span>
<span style="color:#303030"> 234 </span>          assert e<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">getCause</span><span style="color:#ff0080; font-weight:bold">()</span> <span style="color:#bb7977; font-weight:bold">instanceof</span> javax<span style="color:#ff0080; font-weight:bold">.</span>persistence<span style="color:#ff0080; font-weight:bold">.</span>PersistenceException <span style="color:#ff0080; font-weight:bold">:</span>
<span style="color:#303030"> 235 </span>            <span style="color:#a68500">&quot;Expected to fail with: 'javax.persistence.PersistenceException'&quot;</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030"> 236 </span>
<span style="color:#303030"> 237 </span>          log<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">debug</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;Passed expected missing required field value failure: &quot;</span> <span style="color:#ff0080; font-weight:bold">+</span> e<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">getMessage</span><span style="color:#ff0080; font-weight:bold">());</span>
<span style="color:#303030"> 238 </span>        <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 239 </span>        <span style="color:#bb7977; font-weight:bold">finally</span> <span style="color:#ff0080; font-weight:bold">{</span>
<span style="color:#303030"> 240 </span>          Conversation<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">instance</span><span style="color:#ff0080; font-weight:bold">().</span><span style="color:#004466">end</span><span style="color:#ff0080; font-weight:bold">();</span>
<span style="color:#303030"> 241 </span>        <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 242 </span>      <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 243 </span>    <span style="color:#ff0080; font-weight:bold">}.</span><span style="color:#004466">run</span><span style="color:#ff0080; font-weight:bold">();</span>
<span style="color:#303030"> 244 </span>  <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 245 </span>
<span style="color:#303030"> 246 </span>
<span style="color:#303030"> 247 </span>  &#64;<span style="color:#004466">Test</span><span style="color:#ff0080; font-weight:bold">(</span>dependsOnMethods<span style="color:#ff0080; font-weight:bold">={</span> <span style="color:#a68500">&quot;editMovie&quot;</span> <span style="color:#ff0080; font-weight:bold">})</span>
<span style="color:#303030"> 248 </span>  <span style="color:#bb7977; font-weight:bold">public</span> <span style="color:#8080c0; font-weight:bold">void</span> <span style="color:#004466">duplicateUniqueSecondaryIndex</span><span style="color:#ff0080; font-weight:bold">()</span> <span style="color:#bb7977; font-weight:bold">throws</span> <span style="color:#0080c0">Exception</span> <span style="color:#ff0080; font-weight:bold">{</span>
<span style="color:#303030"> 249 </span>    <span style="color:#bb7977; font-weight:bold">new</span> <span style="color:#004466">FacesRequest</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;/view/example/MovieEdit.xhtml&quot;</span><span style="color:#ff0080; font-weight:bold">) {</span>
<span style="color:#303030"> 250 </span>      &#64;Override
<span style="color:#303030"> 251 </span>      <span style="color:#bb7977; font-weight:bold">protected</span> <span style="color:#8080c0; font-weight:bold">void</span> <span style="color:#004466">invokeApplication</span><span style="color:#ff0080; font-weight:bold">()</span> <span style="color:#bb7977; font-weight:bold">throws</span> <span style="color:#0080c0">Exception</span> <span style="color:#ff0080; font-weight:bold">{</span>
<span style="color:#303030"> 252 </span>        Conversation<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">instance</span><span style="color:#ff0080; font-weight:bold">().</span><span style="color:#004466">begin</span><span style="color:#ff0080; font-weight:bold">();</span>
<span style="color:#303030"> 253 </span>        assert <span style="color:#ff0080; font-weight:bold">!</span><span style="color:#004466">isSessionInvalid</span><span style="color:#ff0080; font-weight:bold">() :</span> <span style="color:#a68500">&quot;Invalid session&quot;</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030"> 254 </span>        assert <span style="color:#004466">mockLogin</span><span style="color:#ff0080; font-weight:bold">() :</span> <span style="color:#a68500">&quot;Login failed&quot;</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030"> 255 </span>        <span style="color:#004466">invokeMethod</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;#{movieHome.clearInstance}&quot;</span><span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 256 </span>        <span style="color:#004466">setValue</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;#{movieHome.instance.director}&quot;</span><span style="color:#ff0080; font-weight:bold">,</span> THE_WALL_DIRECTOR<span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 257 </span>        <span style="color:#004466">setValue</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;#{movieHome.instance.title}&quot;</span><span style="color:#ff0080; font-weight:bold">,</span>    THE_WALL_TITLE<span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 258 </span>        <span style="color:#004466">setValue</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;#{movieHome.instance.year}&quot;</span><span style="color:#ff0080; font-weight:bold">,</span>     THE_WALL_YEAR<span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 259 </span>
<span style="color:#303030"> 260 </span>        <span style="color:#bb7977; font-weight:bold">try</span> <span style="color:#ff0080; font-weight:bold">{</span>
<span style="color:#303030"> 261 </span>          <span style="color:#004466">invokeMethod</span><span style="color:#ff0080; font-weight:bold">(</span> <span style="color:#a68500">&quot;#{movieHome.persist}&quot;</span> <span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 262 </span>          assert false <span style="color:#ff0080; font-weight:bold">:</span> <span style="color:#a68500">&quot;Movie with duplicate title persisted!&quot;</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030"> 263 </span>        <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 264 </span>        <span style="color:#bb7977; font-weight:bold">catch</span> <span style="color:#ff0080; font-weight:bold">(</span>javax<span style="color:#ff0080; font-weight:bold">.</span>el<span style="color:#ff0080; font-weight:bold">.</span>ELException e<span style="color:#ff0080; font-weight:bold">) {</span>
<span style="color:#303030"> 265 </span>          assert e<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">getCause</span><span style="color:#ff0080; font-weight:bold">()</span> <span style="color:#bb7977; font-weight:bold">instanceof</span> javax<span style="color:#ff0080; font-weight:bold">.</span>persistence<span style="color:#ff0080; font-weight:bold">.</span>PersistenceException <span style="color:#ff0080; font-weight:bold">:</span>
<span style="color:#303030"> 266 </span>            <span style="color:#a68500">&quot;Expected to fail with: 'javax.persistence.PersistenceException'&quot;</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030"> 267 </span>
<span style="color:#303030"> 268 </span>          log<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">debug</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;Passed expected duplicate unique secondary index failure: &quot;</span> <span style="color:#ff0080; font-weight:bold">+</span> e<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">getMessage</span><span style="color:#ff0080; font-weight:bold">());</span>
<span style="color:#303030"> 269 </span>        <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 270 </span>        <span style="color:#bb7977; font-weight:bold">finally</span> <span style="color:#ff0080; font-weight:bold">{</span>
<span style="color:#303030"> 271 </span>          Conversation<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">instance</span><span style="color:#ff0080; font-weight:bold">().</span><span style="color:#004466">end</span><span style="color:#ff0080; font-weight:bold">();</span>
<span style="color:#303030"> 272 </span>        <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 273 </span>      <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 274 </span>    <span style="color:#ff0080; font-weight:bold">}.</span><span style="color:#004466">run</span><span style="color:#ff0080; font-weight:bold">();</span>
<span style="color:#303030"> 275 </span>  <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 276 </span>
<span style="color:#303030"> 277 </span>  &#64;<span style="color:#004466">Test</span><span style="color:#ff0080; font-weight:bold">(</span>dependsOnMethods<span style="color:#ff0080; font-weight:bold">={</span> <span style="color:#a68500">&quot;duplicateUniqueSecondaryIndex&quot;</span> <span style="color:#ff0080; font-weight:bold">})</span>
<span style="color:#303030"> 278 </span>  <span style="color:#bb7977; font-weight:bold">public</span> <span style="color:#8080c0; font-weight:bold">void</span> <span style="color:#004466">deleteMovie</span><span style="color:#ff0080; font-weight:bold">()</span> <span style="color:#bb7977; font-weight:bold">throws</span> <span style="color:#0080c0">Exception</span> <span style="color:#ff0080; font-weight:bold">{</span>
<span style="color:#303030"> 279 </span>    <span style="color:#bb7977; font-weight:bold">new</span> <span style="color:#004466">FacesRequest</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;/view/example/MovieEdit.xhtml&quot;</span><span style="color:#ff0080; font-weight:bold">) {</span>
<span style="color:#303030"> 280 </span>      &#64;Override
<span style="color:#303030"> 281 </span>      <span style="color:#bb7977; font-weight:bold">protected</span> <span style="color:#8080c0; font-weight:bold">void</span> <span style="color:#004466">invokeApplication</span><span style="color:#ff0080; font-weight:bold">()</span> <span style="color:#bb7977; font-weight:bold">throws</span> <span style="color:#0080c0">Exception</span> <span style="color:#ff0080; font-weight:bold">{</span>
<span style="color:#303030"> 282 </span>        Conversation<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">instance</span><span style="color:#ff0080; font-weight:bold">().</span><span style="color:#004466">begin</span><span style="color:#ff0080; font-weight:bold">();</span>
<span style="color:#303030"> 283 </span>        assert <span style="color:#ff0080; font-weight:bold">!</span><span style="color:#004466">isSessionInvalid</span><span style="color:#ff0080; font-weight:bold">() :</span> <span style="color:#a68500">&quot;Invalid session&quot;</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030"> 284 </span>        assert <span style="color:#004466">mockLogin</span><span style="color:#ff0080; font-weight:bold">() :</span> <span style="color:#a68500">&quot;Login failed&quot;</span><span style="color:#ff0080; font-weight:bold">;</span>
<span style="color:#303030"> 285 </span>        <span style="color:#004466">setValue</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;#{movieHome.movieId}&quot;</span><span style="color:#ff0080; font-weight:bold">,</span> theWallId<span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 286 </span>        <span style="color:#004466">invokeMethod</span><span style="color:#ff0080; font-weight:bold">(</span> <span style="color:#a68500">&quot;#{movieHome.wire}&quot;</span> <span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 287 </span>        Assert<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">assertEquals</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#004466">invokeMethod</span><span style="color:#ff0080; font-weight:bold">(</span> <span style="color:#a68500">&quot;#{movieHome.remove}&quot;</span> <span style="color:#ff0080; font-weight:bold">),</span> <span style="color:#a68500">&quot;removed&quot;</span><span style="color:#ff0080; font-weight:bold">,</span> <span style="color:#a68500">&quot;#{movieHome.remove}&quot;</span><span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 288 </span>        Conversation<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">instance</span><span style="color:#ff0080; font-weight:bold">().</span><span style="color:#004466">end</span><span style="color:#ff0080; font-weight:bold">();</span>
<span style="color:#303030"> 289 </span>      <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 290 </span>    <span style="color:#ff0080; font-weight:bold">}.</span><span style="color:#004466">run</span><span style="color:#ff0080; font-weight:bold">();</span>
<span style="color:#303030"> 291 </span>  <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 292 </span>
<span style="color:#303030"> 293 </span>  &#64;<span style="color:#004466">Test</span><span style="color:#ff0080; font-weight:bold">(</span>dependsOnMethods<span style="color:#ff0080; font-weight:bold">={</span> <span style="color:#a68500">&quot;deleteMovie&quot;</span> <span style="color:#ff0080; font-weight:bold">})</span>
<span style="color:#303030"> 294 </span>  <span style="color:#bb7977; font-weight:bold">public</span> <span style="color:#8080c0; font-weight:bold">void</span> <span style="color:#004466">findMoviesDirectedByJoelCoen</span><span style="color:#ff0080; font-weight:bold">()</span> <span style="color:#bb7977; font-weight:bold">throws</span> <span style="color:#0080c0">Exception</span> <span style="color:#ff0080; font-weight:bold">{</span>
<span style="color:#303030"> 295 </span>
<span style="color:#303030"> 296 </span>    <span style="color:#bb7977; font-weight:bold">new</span> <span style="color:#004466">FacesRequest</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;/view/example/MovieList.xhtml&quot;</span><span style="color:#ff0080; font-weight:bold">) {</span>
<span style="color:#303030"> 297 </span>      &#64;Override
<span style="color:#303030"> 298 </span>      <span style="color:#bb7977; font-weight:bold">protected</span> <span style="color:#8080c0; font-weight:bold">void</span> <span style="color:#004466">updateModelValues</span><span style="color:#ff0080; font-weight:bold">()</span> <span style="color:#bb7977; font-weight:bold">throws</span> <span style="color:#0080c0">Exception</span> <span style="color:#ff0080; font-weight:bold">{</span>
<span style="color:#303030"> 299 </span>        <span style="color:#004466">setValue</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#a68500">&quot;#{movieList.movie.director}&quot;</span><span style="color:#ff0080; font-weight:bold">,</span> DIRECTOR_JOEL_COEN<span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 300 </span>      <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 301 </span>
<span style="color:#303030"> 302 </span>      &#64;Override
<span style="color:#303030"> 303 </span>      <span style="color:#bb7977; font-weight:bold">protected</span> <span style="color:#8080c0; font-weight:bold">void</span> <span style="color:#004466">renderResponse</span><span style="color:#ff0080; font-weight:bold">()</span> <span style="color:#bb7977; font-weight:bold">throws</span> <span style="color:#0080c0">Exception</span> <span style="color:#ff0080; font-weight:bold">{</span>
<span style="color:#303030"> 304 </span>        <span style="color:#0080c0">List</span><span style="color:#ff0080; font-weight:bold">&lt;</span>Movie<span style="color:#ff0080; font-weight:bold">&gt;</span> list<span style="color:#ff0080; font-weight:bold">= (</span><span style="color:#0080c0">List</span><span style="color:#ff0080; font-weight:bold">&lt;</span>Movie<span style="color:#ff0080; font-weight:bold">&gt;)</span> <span style="color:#004466">invokeMethod</span><span style="color:#ff0080; font-weight:bold">(</span> <span style="color:#a68500">&quot;#{movieList.getResultList()}&quot;</span> <span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 305 </span>        Assert<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">assertEquals</span><span style="color:#ff0080; font-weight:bold">(</span>list<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">size</span><span style="color:#ff0080; font-weight:bold">(),</span> <span style="color:#800080; font-weight:bold">2</span><span style="color:#ff0080; font-weight:bold">,</span> <span style="color:#a68500">&quot;#{movieList.getResultList()}&quot;</span><span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 306 </span>        Movie movie <span style="color:#ff0080; font-weight:bold">=</span> list<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">get</span><span style="color:#ff0080; font-weight:bold">(</span><span style="color:#800080; font-weight:bold">0</span><span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 307 </span>        Assert<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">assertEquals</span><span style="color:#ff0080; font-weight:bold">(</span>movie<span style="color:#ff0080; font-weight:bold">.</span><span style="color:#004466">getDirector</span><span style="color:#ff0080; font-weight:bold">(),</span> DIRECTOR_JOEL_COEN<span style="color:#ff0080; font-weight:bold">,</span> <span style="color:#a68500">&quot;movie.getDirector()&quot;</span><span style="color:#ff0080; font-weight:bold">);</span>
<span style="color:#303030"> 308 </span>      <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 309 </span>    <span style="color:#ff0080; font-weight:bold">}.</span><span style="color:#004466">run</span><span style="color:#ff0080; font-weight:bold">();</span>
<span style="color:#303030"> 310 </span>  <span style="color:#ff0080; font-weight:bold">}</span>
<span style="color:#303030"> 311 </span><span style="color:#ff0080; font-weight:bold">}</span>
</pre>
</body>
</html>
